import React, { Component } from 'react'
import {Navigate,Outlet } from  'react-router-dom'
import { Layout } from 'antd';
import  memoryUtils  from '../../utils/memoryUtils'
import LeftNav from '../../components/left-nav';

import HeaderTop from '../../components/header';


const { Header, Footer, Sider, Content } = Layout;

export default class Admin extends Component {



  render() {
    const user=memoryUtils.user
    if(!user._id){
      // 重定向到 login 的界面
      return <Navigate to='/login'></Navigate>
    }
    
    return (
      <Layout style={{height:'100%'}}>
      <Sider>
        <LeftNav></LeftNav>
      </Sider>
      <Layout>
        <Header style={{backgroundColor:'#4096ff', margin:0,padding:0} }>
          <HeaderTop></HeaderTop>
        </Header>
        <Content style={{backgroundColor:'#fff'}}>
          {/*  路由显示的地方, 其实不写也不影响  */}
        <Outlet />
        </Content>
        <Footer style={{textAlign:'center',color:'#ccc'}} >推荐使用谷歌浏览器,可以获得更佳页面操作体验</Footer>
      </Layout>
    </Layout>
    )
  }
}
